var direct = 'DIRECT;';

function FindProxyForURL(url, host) {
    if(isIpv4(host)){
        return direct;
    }
    var suffix;
    var lastDotIndex=host.lastIndexOf('.');
    var pos = lastDotIndex;
    while(1) {
        suffix = host.substring(pos + 1);
        if (domains[suffix]) {
            return direct;
        }
        if (pos <= 0) {
            break;
        }
        pos = host.lastIndexOf('.', pos - 1);
    }
    var lastSecondDotIndex = host.lastIndexOf('.', lastDotIndex - 1);
    var domainPattern=host.substring(lastSecondDotIndex+1, lastDotIndex)+".*";
    return domains[domainPattern] ? direct : proxy;
}

function isIpv4(host){
    var words=host.split('.');
    if(words.length!==4){
        return false;
    }
    for(var i=0;i<4;i++){
        if(isNaN(words[i])){
            return false;
        }
    }
    return true;
}